#ifndef __00_BASIC__ 
#define __00_BASIC__ 

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>

//打印一维数组
void printArray(char* c, const int* a, const int len)
{
	printf("%s (%d)= \t", c, len);
	int i = 0;
	while (i < len)
	{
		if (i == 0)
		{
			printf("%3d", a[i]);
		}
		else
		{
			printf(",%3d", a[i]);
		}
		i++;
	}
	printf(".\n");
}

//打印二维矩阵
void printMatrix(char* c, int* a, int row, int col)
{
	printf("%s (%dx%d):\n", c, row, col);
	for (int i = 0; i < row; i++)
	{
		for (int j = 0; j < col; j++)
		{
			printf("%5d(0x%8X)\t", a[i * row + j], &a[i * row + j]);
		}
		printf("\n");
	}
}

//构建指定行列的二维矩阵
int* Matrix_Malloc(int row, int col)
{
	int* ret = (int*)malloc(row * col * sizeof(int));
	for (size_t i = 0; i < row; i++)
	{
		for (size_t j = 0; j < col; j++)
		{
			ret[i * row + j] = 20770000 + i * 100 + j;
		}
	}
	return ret;
}

void Swap(int* a, int* b)
{
	*a = *a ^ *b;
	*b = *a ^ *b;
	*a = *a ^ *b;
}

#endif